﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Rendering.VisibleLight
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using UnityEngine.Scripting;

#nullable disable
namespace UnityEngine.Rendering
{
  /// <summary>
  ///   <para>Holds data of a visible light.</para>
  /// </summary>
  [UsedByNativeCode]
  public struct VisibleLight : IEquatable<VisibleLight>
  {
    private LightType m_LightType;
    private Color m_FinalColor;
    private Rect m_ScreenRect;
    private Matrix4x4 m_LocalToWorldMatrix;
    private float m_Range;
    private float m_SpotAngle;
    private int m_InstanceId;
    private VisibleLightFlags m_Flags;

    /// <summary>
    ///   <para>Accessor to Light component.</para>
    /// </summary>
    public Light light => (Light) UnityEngine.Object.FindObjectFromInstanceID(this.m_InstanceId);

    /// <summary>
    ///   <para>Light type.</para>
    /// </summary>
    public LightType lightType
    {
      get => this.m_LightType;
      set => this.m_LightType = value;
    }

    /// <summary>
    ///   <para>Light color multiplied by intensity.</para>
    /// </summary>
    public Color finalColor
    {
      get => this.m_FinalColor;
      set => this.m_FinalColor = value;
    }

    /// <summary>
    ///   <para>Light's influence rectangle on screen.</para>
    /// </summary>
    public Rect screenRect
    {
      get => this.m_ScreenRect;
      set => this.m_ScreenRect = value;
    }

    /// <summary>
    ///   <para>Light transformation matrix.</para>
    /// </summary>
    public Matrix4x4 localToWorldMatrix
    {
      get => this.m_LocalToWorldMatrix;
      set => this.m_LocalToWorldMatrix = value;
    }

    /// <summary>
    ///   <para>Light range.</para>
    /// </summary>
    public float range
    {
      get => this.m_Range;
      set => this.m_Range = value;
    }

    /// <summary>
    ///   <para>Spot light angle.</para>
    /// </summary>
    public float spotAngle
    {
      get => this.m_SpotAngle;
      set => this.m_SpotAngle = value;
    }

    /// <summary>
    ///   <para>Light intersects near clipping plane.</para>
    /// </summary>
    public bool intersectsNearPlane
    {
      get => (this.m_Flags & VisibleLightFlags.IntersectsNearPlane) > (VisibleLightFlags) 0;
      set
      {
        if (value)
          this.m_Flags |= VisibleLightFlags.IntersectsNearPlane;
        else
          this.m_Flags &= ~VisibleLightFlags.IntersectsNearPlane;
      }
    }

    /// <summary>
    ///   <para>Light intersects far clipping plane.</para>
    /// </summary>
    public bool intersectsFarPlane
    {
      get => (this.m_Flags & VisibleLightFlags.IntersectsFarPlane) > (VisibleLightFlags) 0;
      set
      {
        if (value)
          this.m_Flags |= VisibleLightFlags.IntersectsFarPlane;
        else
          this.m_Flags &= ~VisibleLightFlags.IntersectsFarPlane;
      }
    }

    public bool Equals(VisibleLight other)
    {
      return this.m_LightType == other.m_LightType && this.m_FinalColor.Equals(other.m_FinalColor) && this.m_ScreenRect.Equals(other.m_ScreenRect) && this.m_LocalToWorldMatrix.Equals(other.m_LocalToWorldMatrix) && this.m_Range.Equals(other.m_Range) && this.m_SpotAngle.Equals(other.m_SpotAngle) && this.m_InstanceId == other.m_InstanceId && this.m_Flags == other.m_Flags;
    }

    public override bool Equals(object obj)
    {
      return obj != null && obj is VisibleLight other && this.Equals(other);
    }

    public override int GetHashCode()
    {
      return (int) ((VisibleLightFlags) ((((((((int) this.m_LightType * 397 ^ this.m_FinalColor.GetHashCode()) * 397 ^ this.m_ScreenRect.GetHashCode()) * 397 ^ this.m_LocalToWorldMatrix.GetHashCode()) * 397 ^ this.m_Range.GetHashCode()) * 397 ^ this.m_SpotAngle.GetHashCode()) * 397 ^ this.m_InstanceId) * 397) ^ this.m_Flags);
    }

    public static bool operator ==(VisibleLight left, VisibleLight right) => left.Equals(right);

    public static bool operator !=(VisibleLight left, VisibleLight right) => !left.Equals(right);
  }
}
